function delay_per_100
global time;
global delay;
dim = size (time);
hold on;

time_inicial = 0;
time_interval = 100;
janela = 2;
pontos_delay_sum = 0;
pontos_delay_count = 0;

j=2;

for i=2:dim(2)
   
    
    
    if time(i)>time_inicial +time_interval- janela && time(i)<time_inicial +time_interval+ janela
        pontos_delay_sum=pontos_delay_sum+delay(i);
        pontos_delay_count = pontos_delay_count+1;
    elseif time(i-1)>time_inicial +time_interval- janela && time(i-1)<time_inicial +time_interval+ janela
        pontos_delay_medio(j) = pontos_delay_sum/pontos_delay_count;
        pontos_delay_tempo(j) = time_interval;
        pontos_delay_sum = 0;
        pontos_delay_count = 0;
        j=j+1;
        time_interval = time_interval + time_interval;
    end
%     
%     if time(i)>200 && time(i)<201
%        pontos_delay(3)=pontos_delay(3)+delay(i);
%         pontos_delay_count(3) = pontos_delay_count(3)+1;
%     end
%     if time(i)>300 && time(i)<301
%         pontos_delay(4)=pontos_delay(4)+delay(i);
%         pontos_delay_count(4) = pontos_delay_count(4)+1;
%     end
%     if time(i)>400 && time(i)<401
%        pontos_delay(5)=pontos_delay(5)+delay(i);
%         pontos_delay_count(5) = pontos_delay_count(5)+1;
%     end
%     if time(i)>500 && time(i)<501
%         pontos_delay(6)=pontos_delay(6)+delay(i);
%         pontos_delay_count(6) = pontos_delay_count(6)+1;
%     end    
%     if time(i)>600 && time(i)<601
%        pontos_delay(7)=pontos_delay(7)+delay(i);
%         pontos_delay_count(7) = pontos_delay_count(7)+1;
%     end
%     if time(i)>700 && time(i)<701
%         pontos_delay(8)=pontos_delay(8)+delay(i);
%         pontos_delay_count(8) = pontos_delay_count(8)+1;
%     end
%     if time(i)>800 && time(i)<801
%         pontos_delay(9)=pontos_delay(9)+delay(i);
%         pontos_delay_count(9) = pontos_delay_count(9)+1;
%     end
%     if time(i)>900 && time(i)<901
%         pontos_delay(10)=pontos_delay(10)+delay(i);
%         pontos_delay_count(10) = pontos_delay_count(10)+1;
%     end
   
end

output = fopen('output','a');
n = length(pontos_delay_tempo);
fprintf(output,'time=[');
for j = 1:n
    fprintf(output,'%5.2f ',pontos_delay_tempo(j));
end;
fprintf(output,'];\n');

n = length(pontos_delay_medio);
fprintf(output,'delay=[');
for j = 1:n
    fprintf(output,'%5.6f ',pontos_delay_medio(j));
end;
fprintf(output,'];\n');


fclose(output);

% plot(pontos_delay_tempo,pontos_delay_medio,'-.*c');